import request from '@/utils/request'

// 新增基础网格
export function insertBaseGrid(data) {
  return request({
    url: '/grid/coordinate/save',
    method: 'post',
    data: data,
  })
}

// 获取所有网格
export function getAllGrid(data) {
  return request({
    url: '/grid/coordinate/base/get',
    method: 'post',
    data: data,
  })
}
// 分页获取网格
export function getPagesGrid(data) {
  return request({
    url: '/grid/coordinate/base/find/pages',
    method: 'post',
    data: data,
  })
}

// 删除基础网格
export function delectGrid(data) {
  return request({
    url: '/grid/coordinate/base/delete/by-id',
    method: 'post',
    data: data,
  })
}

// 修改基础网格
export function updateGrid(data) {
  return request({
    url: '/grid/coordinate/base/update',
    method: 'post',
    data: data,
  })
}
// 修改基础网格
export function updateGridNew(data) {
  return request({
    url: '/grid/coordinate/update',
    method: 'post',
    data: data,
  })
}

// 导出行政网格
export function gridExport(data) {
  return request({
    url: '/grid/coordinate/export',
    method: 'get',
    params: data,
    responseType: 'blob',
  })
}

// 导入行政网格
export function gridImport(data) {
  return request({
    url: '/grid/coordinate/import',
    method: 'post',
    data: data,
  })
}

// 新增省市区域数据
export function addCidade(data) {
  return request({
    url: '/address/province/create',
    method: 'post',
    data: data,
  })
}
// 删除省市区域数据
export function deleteCidade(data) {
  return request({
    url: '/address/province/delete',
    method: 'post',
    data: data,
  })
}
// 获取省市区域数据
export function getCidadeList(data) {
  return request({
    url: '/address/province/get/list',
    method: 'post',
    data: data,
  })
}
// 修改省市区域数据
export function updateCidade(data) {
  return request({
    url: '/address/province/update',
    method: 'post',
    data: data,
  })
}

// 新增责任网格
export function addDutyGrid(data) {
  return request({
    url: '/duty/grid/insert',
    method: 'post',
    data: data,
  })
}

// 查询责任网格
export function getDutyGrid(data) {
  return request({
    url: '/duty/grid/list',
    method: 'get',
    params: data,
  })
}
// 查询责任网格详情
export function dutyGridDetail(data) {
  return request({
    url: '/duty/grid/get',
    method: 'post',
    data: data,
  })
}
// 修改责任网格
export function dutyGridUpdate(data) {
  return request({
    url: '/duty/grid/update',
    method: 'post',
    data: data,
  })
}
// 删除责任网格
export function dutyGridDel(data) {
  return request({
    url: '/duty/grid/delete/by-id',
    method: 'post',
    data: data,
  })
}
// 新增或修改部门
export function depaUpdate(data) {
  return request({
    url: '/department/saveorupdate',
    method: 'post',
    data: data,
  })
}
// 删除部门
export function depaDelete(data) {
  return request({
    url: '/department/delete',
    method: 'post',
    data: data,
  })
}
// 部门详情
export function depaDetail(data) {
  return request({
    url: '/department/detail',
    method: 'get',
    params: data,
  })
}
// 部门列表
export function depaList(data) {
  return request({
    url: '/department/list',
    method: 'get',
    params: data,
  })
}
// 通过责任部门id获取责任网格信息
export function getDepaDutyGrid(data) {
  return request({
    url: '/department/get/duty-grid',
    method: 'get',
    params: data,
  })
}
// 获取职能部门角色人员
export function getRole(data) {
  return request({
    url: '/role/department/get',
    method: 'post',
    data: data,
  })
}
// 为角色绑定责任部门
export function bindingDepar(data) {
  return request({
    url: '/role/binding/department',
    method: 'post',
    data: data,
  })
}
// 通过责任部门id查询绑定的角色
export function getDeparRole(data) {
  return request({
    url: '/role/get/by-departmentid',
    method: 'get',
    params: data,
  })
}
// 获取当前角色下的人员信息
export function getRoleUser(data) {
  return request({
    url: '/user/get/by-roelid',
    method: 'get',
    params: data,
  })
}
// 批量修改用户责任网格信息
export function userBindGrid(data) {
  return request({
    url: '/user/batch/update/gridid',
    method: 'post',
    data: data,
  })
}
// 导出责任网格
export function exportDutyGrid(data) {
  return request({
    url: '/duty/grid/export',
    method: 'get',
    params: data,
    responseType: 'blob',
  })
}
// 通过level网格级别批量修改网格数据
export function upLevelStyle(data) {
  return request({
    url: '/grid/coordinate/update_by_level',
    method: 'post',
    data: data,
  })
}
// 根据部门id获取责任网格信息（含genJson数据转换）
export function getDutyGridJson(data) {
  return request({
    url: '/duty/grid/list_to_department/' + data,
    method: 'get',
  })
}
